﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace DataManager
{
    public partial class frmJatszaRendezte : Form
    {
        Movies m_Movies;
        int m_Id;
        string m_Name;
        int m_AorD;

        public frmJatszaRendezte(int Id, string Name, int AorD)
        {
            InitializeComponent();
            m_Movies = new Movies();
            m_Id = Id;
            m_Name = Name;
            m_AorD = AorD;
        }

        private void frmJatsza_Load(object sender, EventArgs e)
        {
            lblActor.Text = m_Name+" filmjei:";
            FillDgvPlays();
        }

        /// <summary>
        /// Feltolti a DataGridViewt az adatoknak megfeleloen
        /// </summary>
        private void FillDgvPlays()
        {
            dgvPlays.Rows.Clear();
            List<Movie> movieList = null;
            if (m_AorD == 0)
            {
                movieList = m_Movies.GetMovieListOnActor(m_Name);
            }
            else
            {
                movieList = m_Movies.GetMovieListOnDirector(m_Name);
            }
            foreach (Movie item in movieList)
            {
                dgvPlays.Rows.Add(item.MovieId, item.OriginalTitle, item.HungarianTitle, item.ReleaseDate);
            }
        }

        private void btnVissza_Click(object sender, EventArgs e)
        {
            frmSzineszekRendezok myForm = new frmSzineszekRendezok();
            Hide();
            myForm.ShowDialog();
            Close();
        }

        private void btnKilepes_Click(object sender, EventArgs e)
        {
            Close();
        }
    }
}
